From: Richard M. Stallman Date: Tue, 9 Mar 1993 22:14:36 +0000 (+0000) Subject: (c-beginning-of-statement): If next to a comment, use sentence motion. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~96976 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=17f0e88a1b10483a4f087aa1303baed865d1c908;p=emacs.git (c-beginning-of-statement): If next to a comment, use sentence motion. --- diff --git a/lisp/progmodes/c-mode.el b/lisp/progmodes/c-mode.el index b39182f02af..957db277012 100644 --- a/lisp/progmodes/c-mode.el +++ b/lisp/progmodes/c-mode.el @@ -874,13 +874,18 @@ Otherwise return nil and don't move point." "Go to the beginning of the innermost C statement. With prefix arg, go back N - 1 statements. If already at the beginning of a statement then go to the beginning of the preceeding one. -If within a string or comment, move by sentences instead of statements." +If within a string or comment, or next to a comment (only whitespace between), +move by sentences instead of statements." (interactive "p") (let ((here (point)) state) (save-excursion (beginning-of-defun) (setq state (parse-partial-sexp (point) here nil nil))) - (if (or (nth 3 state) (nth 4 state)) + (if (or (nth 3 state) (nth 4 state) + (looking-at (concat "[ \t]*" comment-start-skip)) + (save-excursion (skip-chars-backward " \t") + (goto-char (- (point) 2)) + (looking-at "\\*/"))) (forward-sentence (- count)) (while (> count 0) (c-beginning-of-statement-1)